<?php

$email = $_POST['email'];

include_once("conexao.php");
$sql = "select * from usuario where email = '$email'";
$result= mysql_query($sql) or die ("Erro: " . mysql_error());
if(mysql_num_rows($result)){
    echo '{"usuarios":[';

    $first = true;
    while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
        //  cast results to specific data types

        if($first) {
            $first = false;
        } else {
            echo ',';
        }
        echo json_encode($row);
    }
    echo ']}';
} else {
    echo '[]';
}
?>
